package com.example.demo.controller;

import com.example.demo.bean.DeleteData;
import com.example.demo.service.DeleteService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

@RestController
public class DeleteController {
    @Autowired
    private DeleteService ds;
    @RequestMapping(value="/Delete",method = RequestMethod.POST)
    public DeleteData simpleDelete(HttpServletRequest request){
        DeleteData deleteData=new DeleteData();
        Map<String,String[]> map = request.getParameterMap();
        if(ds.simpleDelete(map)){
            deleteData.setCode(200);
            deleteData.setMessage("success");
        }else{
            deleteData.setCode(500);
            deleteData.setMessage("fail");
        }
        return deleteData;
    }
}
